﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Web;

namespace NX5Web.Controllers.WSSObjects
{
    public class WSSRequest
    {
        public String Action { set; get; }

        public String Message { set; get; }

        public String Callback { set; get; }
    }

    public class WssResponse
    {
        private WebSocket _Socket = null;

        public WebSocket Socket
        {
            set { _Socket = value; }
            get
            {
                try
                {
                    Newtonsoft.Json.JsonConvert.SerializeObject(_Socket);
                    return _Socket;
                }
                catch
                {
                    this.IsConnected = false;
                    return null;
                }
            }
        }

        private Boolean _IsConnected = false;

        public Boolean IsConnected
        {
            set { _IsConnected = value; }
            get
            {
                if (_Socket == null)
                {
                    return false;
                }
                return _IsConnected;
            }
        }
    }
}